#include <iostream>
using namespace std;
template <class T>
class Firendly;
template <class T>
void f(const Firendly<T> &);

template <class T>
class Firendly
{
    T t;

public:
    Firendly(const T &theT) : t(theT)
    {
    }
    friend void f<>(const Firendly<T> &);
    void g() { f(*this); }
};
void h()
{
    f(Firendly<int>(1));
}
template <class T>
void f(const Firendly<T> &fo)
{
    cout << fo.t << endl;
}
int main(int argc, char *argv[])
{
    h();
    Firendly<int>(2).g();
}